import { useEffect, useState } from "react"
import { getStorageManager } from '@/storage'

export default function LazyImage(props:{fullPath:string}){

    const [url, setUrl] = useState('')

    useEffect(()=>{
         getStorageManager().getVisionStorage().getLink(props.fullPath).then(url=>{
            setUrl(url)
         })
    },[props.fullPath])

    return <div style={{
        width: 100,
        height: 100,
        backgroundImage: `url(${url})`,
        backgroundSize: 'contain',
        backgroundRepeat: 'no-repeat',
        backgroundPosition: 'center center'
    }} />
}